<?php

namespace frontend\controllers;

use Yii;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\helpers\Url;
use yii\web\Controller;
use yii\web\Response;
use yii\base\ErrorException;
use yii\helpers\Html;
use common\models\member\Member;
use common\models\notice\Notice;
use yii\db\Query ;
use common\models\orders\Orders;
use common\models\invoice\Invoice;

class FinanceController extends Controller
{
    public $layout = 'ucenter';

    //订单列表
	public function actionOrderlist()
	{
		$member_id = Yii::$app->user->id;
		$data = Orders::find()->where(['mid'=>$member_id])->all();
		if(!$data){
			return $this->render('orderlist',[
				'information' => '暂无数据'
			]);
		}else{
			return $this->render('orderlist',[
				'data' => $data
			]);
		}
	}

    //订单详情
    public function actionOrderinfo($id)
    {
		$data = Orders::find()->where(['id'=>$id])->one();
		return $this->render('orderinfo',[
			'data' =>$data
		]);
    }


    //发票列表
    public function  actionInvoicelist()
    {
		$member_id = Yii::$app->user->id;
		$data = Invoice::find()->where(['oid'=>$member_id])->all();
		if(!$data){
			return $this->render('invoicelist',[
				'information' => '暂无数据'
			]);
		}else{
			return $this->render('invoicelist',[
				'data' => $data
			]);
		}
    }

	//发票详情
    public function actionInvoiceinfo($id)
    {
		$data = Invoice::find()->where(['id'=>$id])->one();
		$order = Orders::find()->all();
		return $this->render('invoiceinfo',[
			'data' =>$data,
			'order' =>$order
		]);
    }
}